import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";
import Home from "../views/Home.vue";

import Permission from "./permission";

const routes: Array<RouteRecordRaw> = [
  {
    path: "/index",
    name: "首页",
    component: resolve => require(["@/views/Home"], resolve),
    children: [
      {
        name: "首页",
        path: "/index",
        component: resolve => require(["@/views/index/Index"], resolve)
      },
      ...Permission
    ]
  },
  {
    path: "/*",
    redirect: "/index"
  }
];

const router = createRouter({
  history: createWebHashHistory(),
  routes
});

export default router;
